const fs = require('fs');

let p = new Promise((resolve, reject) => {
    fs.readFile('./files/a.txt', 'utf-8', (err, data) => {
        err ? reject(err) : resolve(data.length);
    })
})

p.then(result => {
    console.log(result);
    return new Promise((resolve, reject) => {
        fs.readFile('./files/b.txt', 'utf-8', (err, data) => {
            err ? reject(err) : resolve(data.length);
        })
    })
}).then(result => {
    console.log(result);
    return new Promise((resolve, reject) => {
        fs.readFile('./files/c.txt', 'utf-8', (err, data) => {
            err ? reject(err) : resolve(data.length);
        })
    })
}).then(result => {
    console.log(result);
}).catch(err => {
    console.log(err);
})